﻿#ifndef __SS_SERVER_SELECT_H__
#define __SS_SERVER_SELECT_H__
#include "ssSocketDef.h"
#include "ssSocketSelect.h"
#include "../container/ssList.h"
#include <time.h>

namespace StarSeeker
{

class ssServerSelect : public ssSocketSelect
{
public:
	// 构造和析构
	ssServerSelect();
	~ssServerSelect();
	//new socket
	bool InitParam(u32 sendSize, u32 recvSize, time_t outTime=0);
	//start listen
	bool32 CreateListenSocket(bool isV6, const char* ip, u16 port);

protected:
	// select 模式下的事件虚函数
	virtual void BeforeFDSET();
	virtual void ProcessFDSET();
	virtual void AfterFDSET();
	//新连接进入
	virtual void OnNewConnect(ssClientSocket &c) {};
	//收到数据
	virtual void OnReceive(ssClientSocket &c) {};
	//连接断开
	virtual void OnDisconnect(ssClientSocket &c) {};


	ssListenSocket			m_sListen;
	ssList<ssClientSocket>	m_sClient;
	u32						m_sendSize;
	u32						m_recvSize;
	u32						m_session;
	time_t					m_outTime;
};

}
#endif
